import React, { PureComponent } from 'react';
import "../../../styles/Index/Home/SearchBox.scss"
import { withRouter } from 'react-router-dom';
import { City } from "../../../api/index"

class SearchBox extends PureComponent {
    async componentDidMount() {
        // let res =await City()
        // console.log('城市',res);
    }
    render() {
        return (
            <div className='searchbox'>
                <span onClick={() => {  }}>西安</span>
                <input onClick={() => { this.props.history.push('/search') }} type="text" placeholder='华为手机' />
                <span onClick={() => { this.props.history.push(localStorage.getItem('token') ? '/index/mine' : '/login') }}>{localStorage.getItem('token') ? '我的' : '登录'}</span>
            </div>
        );
    }
}

export default withRouter(SearchBox);